// components/custom-modal/custom-modal.js
Component({
  properties: {
    showModal: {
      type: Boolean,
      value: false
    },
    title: {
      type: String,
      value: '提示'
    },
    placeholderText: {
      type: String,
      value: '请输入内容'
    },
    cancelText: {
      type: String,
      value: '取消'
    },
    confirmText: {
      type: String,
      value: '确定'
    }
  },

  data: {
    inputValue: ''
  },

  methods: {
    onInput(e) {
      this.setData({ inputValue: e.detail.value });
    },

    onCancel() {
      this.triggerEvent('cancel');
      this.setData({ inputValue: '' });
    },

    onConfirm() {
      this.triggerEvent('confirm', { content: this.data.inputValue });
      this.setData({ inputValue: '' });
    }
  }
});